<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="images/1.png" alt="">
    <button>选择</button>
</body>
</html>
<script>
    var btn=document.querySelector('button');
    var img=document.querySelector('img');
    btn.onclick=function(){
        img.src='images/2.jpg'
    }
</script>